/**
 * Created by zyg on 16/1/28.
 */
var fs = require('fs');
var _ = require('lodash');

var actionsDir = './actions/';

var actions = _.filter(fs.list(actionsDir), function (file) {
  return file.indexOf('.js') !== -1
}).filter(function (file) {
  return file.indexOf('index.js') === -1
}).map(function (file) {
  return file.replace('.js','')
});

/**
 *
 * @param Object commandOne
 */
function executeAction(action,commandArguments,callback) {

  log2(action,commandArguments);

  require('./'+action)(commandArguments,callback);
};

log(actions);

executeAction.supportActions = actions;

module.exports = executeAction;